home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Developer Utilities / Installer 4.0.3 SDK / Script Examples / • Example Example / Example.r < prev    next >
Encoding:
Text File  |  1994-11-15  |  14.7 KB  |  370 lines  |  [TEXT/MPS ]

  1. //
  2. //    example.r    
  3. //
  4. //
  5. //        This example is intended as a guideline for working with the
  6. //        rest of the examples included with Installer 4.0.3. What this
  7. //        specific example does is install one copy of TeachText to a folder
  8. //        named "Example Example" on the selected target volume.
  9. //
  10. //        To use any one of the examples, launch MPW ( Macintosh Programmer's
  11. //        Workshop ), and set the current working directory to the folder
  12. //        containing the example you are working on.
  13. //
  14. //        Most MPW configurations include a "Directory" menu. You may choose
  15. //        the current working directory by choosing "Set Directory…" from
  16. //        the "Directory" menu.
  17. //
  18. //        Each installation example includes a source script for the install
  19. //        script to be included with the installation disks. This source script
  20. //        is an MPW text file, and is always named with a ".r" extension. For
  21. //        this example the source script is named "Example.r".
  22. //
  23. //        Also included in each example is a build script in makefile form. 
  24. //        This makefile is an MPW text file, and is named "makefile" in all
  25. //        the examples. This makefile is called when you tell MPW to build
  26. //        the installation script to be included with the installation disks.
  27. //
  28. //        Each example also includes the compiled ( actually rezzed ) script
  29. //        that will be placed on the installation disks. This "finished"
  30. //        installer script will serve to "drive" the Installer application
  31. //        on your installation disks. In this case the finished installer 
  32. //        script is named "Example".
  33. //
  34. //        A debugger version of the finished installer script is also included
  35. //        and is named by appending "w/ debugger" to the original finished
  36. //        installer script. In this case it is called "Example w/ debugger".
  37. //
  38. //
  39. //    How To Build the Script:
  40. //    
  41. //        To build installer script to include on installation disks, select
  42. //        the "Build…" menu item from the "Build" menu. Enter the scriptName
  43. //        without the .r extension, which in the case of this example would 
  44. //        be "Example". ( Do not include the double quotes )
  45. //
  46. //        To build the Installer Debugger version of the installer script enter 
  47. //        the scriptname with the addition ".debug", which in this case would
  48. //        be "Example.debug". ( Do not include the double quotes )
  49. //
  50. //    If you are using InstaCompOne compression or splitting:
  51. //
  52. //        You must also include a copy of the file "InstaCompOneSCExt.rsrc"
  53. //        that has been renamed to "fileCompress.scx". This file can be found
  54. //        inside the folder "InstaCompOne 1.0" included in the 4.0.3 SDK.
  55. //        The renamed file is a ScriptCheck extension that will add functionality
  56. //        to ScriptCheck for dealing with InstaCompOne archives. For your
  57. //        convenience, a copy of this renamed file will be placed in this folder
  58. //        when the makefile is run by the "Build" command.
  59. //
  60. //    Running the installation examples:
  61. //
  62. //        From your hard drive -
  63. //
  64. //        The most convenient way to run the examples is to place a copy of
  65. //        the Installer 4.0.3 application on your desktop. Then from within 
  66. //        the Finder, open the folder containing the example to try out, and
  67. //        drag-drop the finished installer script onto the Installer 4.0.3 
  68. //        application on your desktop. This will allow you to run the examples 
  69. //        directly from the Installer SDK folders, rather than having to copy 
  70. //        files onto a diskette.
  71. //
  72. //        From a diskette -
  73. //
  74. //        Insert a diskette, and rename it to "Disk 1". Be sure this name
  75. //        is entered correctly with a space. Take all the contents of 
  76. //        "Disk 1", which in this case is the copy of TeachText.  Also, you will 
  77. //        need to copy over the finished or rezzed installer script and a copy 
  78. //        of the Installer application. If you are going to run the debugger 
  79. //        version of the installer script be sure to copy over the debugger 
  80. //        version of the Installer application.
  81. //
  82. //        NOTE: Some of the examples use copies of TeachText that have been 
  83. //        slightly modified, so be careful to use the actual copy of TeachText 
  84. //        from the specific example when preparing an installation diskette.
  85. //
  86. //    Running the debugger version of the examples:
  87. //
  88. //        Place a copy of the Debugger version of the Installer 4.0.3 application 
  89. //        on your desktop. Then drag-drop a debugger version of the finished 
  90. //        installer script onto the debugger version of the installer on the 
  91. //        desktop. The installer debugger will display information about the 
  92. //        progress of the installation in a window. 
  93. //
  94. //        To get even more out of the installer debugger, click in 
  95. //        the debugger window before actually beginning an installation. You
  96. //        may then select from the two menus "Wasabi" and "Show" to select
  97. //        different options for displayed information. Especially helpful are
  98. //        the "Show" menu items "Frameworks", "Rules", and "Rules Clauses".
  99. //        If the "Frameworks", "Rules", "Rules Clauses" are checked in the
  100. //        debugger menu, then the analysis of rules is displayed each time
  101. //        one of the rules frameworks is run. You can force this to happen
  102. //        by selecting back and forth between Easy Install and Custom Install,
  103. //        by clicking in the "Switch Disk" button, or by going to the Finder
  104. //        and returning the the Installer application.
  105. //
  106. //        NOTE: This example does not use installer frameworks or rule clauses
  107. //        so it's probably not the best place to check out the debugger support
  108. //        for checking out rules and frameworks from the debugger. For a good
  109. //        example of rules and frameworks, try the "System Rules - Desk Accessory"
  110. //        and "System Rules - Application" examples included with the SDK.
  111. //
  112. //    mark young • 08/25/94
  113. //    
  114. //    Copyright 1994, Apple Computer, Inc., All Rights Reserved
  115. //
  116.  
  117. #include "InstallerTypes.r"
  118.  
  119. // Include the InstaCompOne atom extender stuff
  120. // making sure not to add their version resource
  121. // to our installer script. Also, since this include
  122. // is a resource include instead of a #include, it is
  123. // not actually a pre-processor thing, and won't be effected
  124. // by a -i option within the rez line in the makefile. 
  125. include ":::InstaCompOne 1.0:InstaCompOneAtomExt.rsrc" NOT 'vers';
  126.  
  127.  
  128. // • packages
  129.  
  130. // package that demonstrates simple case of InstaCompOne archive
  131. resource 'inpk' (100) {
  132.     format0 {
  133.         showsOnCustom,        // This flag determines whether or not
  134.                             // the package will be visible as a 
  135.                             // sub-package in Custom Install, otherwise 
  136.                             // this flag is ignored when using 4.0
  137.                             // method of creating Custom Install
  138.                             // user selectable options.
  139.                             
  140.         removable,            // This flag determines whether or not
  141.                             // not the package should be listed in
  142.                             // Custom Install as removable, and whether
  143.                             // to remove this package when performing
  144.                             // a Custom Removal.
  145.                             
  146.         dontForceRestart,    // If any packages that are included in an
  147.                             // installation have this flag set to
  148.                             // 'forceRestart', then the user will be
  149.                             // forced to restart their computer 
  150.                             // immediately after installation.
  151.  
  152.         0,                    // Package comment ('inpc' or 'icmt' ) rsrc ID.
  153.                             // NOTE: usage of the new package comment
  154.                             // resource ( 'inpc' ), allows inclusion
  155.                             // of up to 32K of text to describe a package.
  156.                             // This extends the limit of 255 characters
  157.                             // of description text in the old style
  158.                             // 'icmt' package comments resource type.
  159.                             
  160.                             // For full demonstration of implementing
  161.                             // package comment resources, see the
  162.                             // 'Custom UI Example' included with
  163.                             // the Installer 4.0.3 SDK examples.
  164.                             
  165.         0,                    // Total size of all files included in
  166.                             // this package. If value is zero, this
  167.                             // field will be filled by ScriptCheck.
  168.                             // NOTE: This field is not used during
  169.                             // checks for sufficient disk space, but
  170.                             // is displayed to user during Custom Install.
  171.                             
  172.         "TeachText to \"Example Example\" folder ( InstaCompOne compression )",
  173.                             // The description of the package when
  174.                             // displayed as a selectable option 
  175.                             // in Custom Install and Custom Remove
  176.         {    
  177.         'infa', 1000;        // List of all the items to be included
  178.                             // as part of this package. This list can
  179.                             // contain any of the atom resource types,
  180.                             // other package resources, or in the case
  181.                             // of a package being used as a divider line
  182.                             // this list can be empty.
  183.         },
  184.     }
  185. };
  186.  
  187. // • file atoms
  188.  
  189. resource 'infa' (1000) {
  190.     format1 {
  191.         deleteWhenRemoving,                //  Delete on deinstall
  192.         deleteWhenInstalling,            //  Remove preexisting
  193.         copy,                            //  Copy on Install
  194.         dontIgnoreLockedFile,            //  Respect file locking
  195.         dontSetFileLocked,                //  Leave installed file unlocked
  196.         useSrcCrDateToCompare,            //  Use creation date for compare
  197.         srcNeedNotExist,                //  Create a new file if necessary
  198.         
  199.         // this line must be set to "rsrcForkInDataFork" when working 
  200.         // with file items compressed into InstaCompOne archives,
  201.         // otherwise this flag should be set to 'rsrcForkInRsrcFork'
  202.         rsrcForkInDataFork,                //  • Resource stuff in Data fork
  203.         
  204.         leaveAloneIfNewer,                //  On Easy Install, this causes
  205.                                         //    the target file to be preserved
  206.                                         //     if it is newer than the one
  207.                                         //    about to replace it. On Custom
  208.                                         //     Install this causes a dialog to
  209.                                         //     be displayed to the user asking
  210.                                         //  "Newer, Older, Cancel"
  211.                                         
  212.         updateExisting,                    //  Update an existing file
  213.         copyIfNewOrUpdate,                //  Copy whether target exists or not
  214.         rsrcFork,                        //  Copy resource fork
  215.         dataFork,                        //  Copy data fork
  216.         
  217.         0,                    // TARGET - size ( filled in by ScriptCheck )
  218.         0x0,                // finder attribute flags ( filled in by ScriptCheck )
  219.         10000,                // TARGET - file spec ( 'intf' )
  220.         {    
  221.             10000,            // SOURCE - file spec ( 'infs' )
  222.             0,                 // DATA fork - size ( filled in by ScriptCheck )
  223.             0                // RSRC fork - size ( filled in by ScriptCheck )
  224.         },    
  225.         
  226.         0x0,                // SOURCE - version number for comparisons
  227.                             // value of 0x0 specifies not to perform 
  228.                             // version comparison
  229.                             
  230.         0,                    // 'invc' code resource - version comparison routine 
  231.                             //    ( none used here )
  232.         
  233.         241,                // 'inex' resource definition for atom extender
  234.                             // • #241 is for built in InstaCompOne extender
  235.                             
  236.         ""                    // file atom description 
  237.                             // ( Installer will use filename if blank )
  238.     }
  239. };
  240.  
  241.  
  242. // • file specs
  243.  
  244. // NOTE: Installer 4.0.3 supports both 'intf' and 'infs' resource types
  245. // as target file specs. It is recommended that 'intf' format1 be used.
  246.  
  247. // target file spec
  248. resource 'intf' (10000) {
  249.     format1 {
  250.         noSearchForFile,        // use default search path
  251.         
  252.                                 // NOTE: See the "Search Proc [insp]
  253.                                 // Example" for an example of how to
  254.                                 // override default search path
  255.         
  256.         // If the TypeCrNeedNotMatch flag is specified,
  257.         // then the two fields of Type and Creator will be ignored
  258.         // unless InstaCompOne compression is being used.
  259.         
  260.         // If the TypeCrMustMatch flag is specified, then
  261.         // the installer will give an error message that the
  262.         // target file cannot be replaced when the target
  263.         // file's Type and Creator do not match those specified here.
  264.         
  265.         TypeCrNeedNotMatch,        // target type and creator don't have to match
  266.         
  267.         'APPL',                    // TYPE ( for file search if 'searchForFile' )
  268.         'ttxt',                    // CREATOR ( for file search if 'searchForFile' )
  269.         
  270.                                 // NOTE: If using InstaCompOne compression
  271.                                 // these values are also used to 
  272.                                 // specify which compressed file within
  273.                                 // an archive should be expanded during
  274.                                 // installation of a file atom. ( see below )
  275.  
  276.         
  277.         // The next three fields are provided so that the scriptwriter
  278.         // can specify certain file information when creating a new file
  279.         // or updating an existing one. If ScriptCheck fills in the values
  280.         // it will use the values from the existing source file.
  281.         
  282.         0x0,                    // Target - finder flags
  283.                                 //    ( ScriptCheck fills in flags if set to 0 )
  284.         
  285.         1,                        // Target - creation date 
  286.         1,                        // Target - mod date 
  287.                                 //    ( ScriptCheck fills in dates set to 1 )
  288.                                 
  289.         0,                        // 'insp' resource ID ( file search proc )
  290.                                 // none used in this case
  291.                                 
  292.                                 // NOTE: the file search proc feature is
  293.                                 // only supported with file atoms ( 'infa' )
  294.                                 // and resource atoms ( 'inra' ). All other
  295.                                 // atoms referencing an 'intf' with an 'insp'
  296.                                 // reference will use the default file search
  297.                                 // mechanism of the installer.
  298.                                 
  299.         ":Example Example:TeachText"    // path to target file
  300.         
  301.                         // NOTE: when using InstaCompOne compression
  302.                         // the filename specified in the path to 
  303.                         // target file ( along with the type and 
  304.                         // creator specified above ) are used to 
  305.                         // specify which file within the source archive 
  306.                         // should be be decompressed. This filename,
  307.                         // type, and creator must match exactly those
  308.                         // of the compressed file item within the archive.
  309.                         // If ScriptCheck tells you there is a problem 
  310.                         // #28202, then check the filename in the target 
  311.                         // path, type, creator to be sure that they matche
  312.                         // filename, type, creator in the archive. You can 
  313.                         // check the filename, type, creator in the archive 
  314.                         // by using the command
  315.                         // [ InstaCompOneTool -o archiveName -L ] in MPW.
  316.                                 
  317.     }
  318. };
  319.  
  320.  
  321. // source file spec
  322. resource 'infs' (10000) {
  323.     'idcp',                        // TYPE of source file
  324.     'kakc',                        // CREATOR of source file
  325.                                 
  326.                                 // NOTE: When using InstaCompOne compression
  327.                                 // for files ( as in this example ) these values
  328.                                 // should always be used ( 'idcp' and 'kakc' ).
  329.                                 
  330.                                 // When using InstaCompOne compression for
  331.                                 // resource items, the type should be 'ircp'
  332.                                 // and the creator should be 'kakc'.
  333.                                 
  334.                                 // When not using InstaCompOne compression
  335.                                 // these values should match those of your
  336.                                 // source file.
  337.                                 
  338.     0x1,                        // creation DATE for source file
  339.                                 // value of zero matches any date
  340.                                 // value of 1 filled by ScriptCheck
  341.                                 
  342.     noSearchForFile,            // IGNORED in Installer 4.0.x
  343.     
  344.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  345.                                 
  346.                                 // NOTE: If 'TypeCrMustMatch' is used, 
  347.                                 // ScriptCheck will complain if type and
  348.                                 // creator of source file do not match,
  349.                                 // and an error will occur during installation.
  350.                                 
  351.                                 // If 'TypeCrNeedNotMatch' is used,
  352.                                 // type and creator of source file will be
  353.                                 // ignored.
  354.                                 
  355.                                 // When using InstaCompOne compression, this
  356.                                 // fields should always be 'TypeCrMustMatch'
  357.                                 
  358.     "Disk 1:Tome"                // PATH to source file        
  359.     
  360.                                 // NOTE: When using InstaCompOne compression
  361.                                 // this should be path to the archive containing
  362.                                 // the file to be decompressed. The actual name
  363.                                 // of the file to be decompressed is specified
  364.                                 // in the target file spec ( 'intf' ).
  365.                                 
  366.                                 // When not using InstaCompOne compression
  367.                                 // this should be path to the file to install.
  368. };
  369.  
  370.